import request from '@/utils/request'
// https://www.kancloud.cn/yunye/axios/234845
export function login (mobile, password) {
  return request({
    url: '/login',
    method: 'post',
    data: {
      mobile,
      password
    }
  })
}

export function register (mobile, password, code) {
  return request({
    url: '/registered',
    method: 'post',
    data: {
      mobile,
      password,
      code
    }
  })
}

// 解析token获取用户信息
export function getUserInfo () {
  return request({
    url: '/getCustomerInfo',
    method: 'post'
  })
}

export function forgetPassword (mobile, password, code) {
  return request({
    url: '/editPassword',
    method: 'post',
    data: {
      mobile,
      password,
      code
    }
  })
}

export function sendMobileCode (mobile) {
  return request({
    url: '/sendTempSMS',
    method: 'post',
    data: {
      mobile
    }
  })
}

export function updateCustomerMessage (data) {
  return request({
    url: '/customer/updateCustomerMessage',
    method: 'post',
    data: data
  })
}

export function saveLoanInfo (data) {
  return request({
    url: '/customer/saveFinancial',
    method: 'post',
    data
  })
}

export function getLoanInfo (data) {
  return request({
    url: '/customer/findFinancialByCustomerId',
    method: 'post',
    data
  })
}

// 保存cid
export function addCidToCustomer (data) {
  return request({
    url: '/addCidToCustomer',
    method: 'post',
    data
  })
}

// 用户列表加入销售Id
export function addSalerToCustomer (data) {
  return request({
    url: '/customer/addSalerToCustomer',
    method: 'post',
    data
  })
}

// 保存客服id到用户列表
export function addServiceToCustomer (data) {
  return request({
    url: '/customer/addServiceToCustomer',
    method: 'post',
    data
  })
}

// 图片上传
export function uploadBase64 (data) {
  return request({
    url: '/file/uploadBase64',
    method: 'post',
    data: data
  })
}

// 意见反馈
export function submitFeedback (data) {
  return request({
    url: '/feedback/submitFeedback',
    method: 'post',
    data: data
  })
}

// 微信登录
export function wxLogin (data) {
  return request({
    url: '/wxLogin',
    method: 'post',
    data: data
  })
}

// 保存用户微信信息
export function saveWXInfo (data) {
  return request({
    url: '/saveWXInfo',
    method: 'post',
    data: data
  })
}
